package com.wx.service;

import com.wx.common.SecurityUser;
import com.wx.domain.dto.ActionBindRoleDto;
import com.wx.domain.dto.PermissionDto;
import com.wx.domain.vo.AuthorityTreeVo;
import com.wx.entity.SysAuthority;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;
import java.util.List;

/**
 * <p>Title:      AuthorityService. </p>
 * <p>Description TODO </p>
 * <p>Copyright: Copyright (c) 2016</p>
 * <p>Company:    医百科技有限公司 </p>
 *
 * @author <a href="xinglinglove1029@163.com"/>杨文生</a>
 * @since 2018 /1/16 14:50
 */
public interface SysAuthorityService extends BaseService<SysAuthority> {

    /**
     * <p>Title:      getOwnAuthority. </p>
     * <p>Description 根据userId查询拥有的权限</p>
     *
     * @param userId the user id
     * @return own authority
     * @Author <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since 2018 /1/16 15:24
     */
    List<SysAuthority> getOwnAuthority(String userId);

    /**
     * <p>Title:     saveAuthorityInfo. </p>
     * <p>Description 保存权限信息</p>
     *
     * @param authority   the authority
     * @param user
     * @return int
     * @Author <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since 2018 /4/27 10:17
     */
    int saveAuthorityInfo(SysAuthority authority, SecurityUser user);

    /**
     * <p>Title:     modifyAuthority. </p>
     * <p>Description 修改权限信息</p>
     *
     * @param authority   the authority
     * @param user
     * @return int
     * @Author <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since 2018 /4/27 10:17
     */
    int modifyAuthority(SysAuthority authority, SecurityUser user);

    /**
     * <p>Title:     disableAuthorityById. </p>
     * <p>Description 禁用权限信息</p>
     *
     * @param id          the id
     * @param authUserDto the auth user dto
     * @return int
     * @Author <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since 2018 /4/27 10:17
     */
    int disableAuthorityById(String id, SecurityUser authUserDto);

    /**
     * <p>Title:     enableAuthorityById. </p>
     * <p>Description 启用权限信息</p>
     *
     * @param id          the id
     * @param authUserDto the auth user dto
     * @return int
     * @Author <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since 2018 /4/27 10:17
     */
    int enableAuthorityById(String id, SecurityUser authUserDto);

    /**
     * <p>Title:     deleteAuthorityById. </p>
     * <p>Description 根据id删除权限信息</p>
     *
     * @param id          the id
     * @param securityUser the auth user dto
     * @return int
     * @Author <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since 2018 /4/27 10:17
     */
    int deleteAuthorityById(String id, SecurityUser securityUser);

    /**
     * <p>Title:     queryListPage. </p>
     * <p>Description 分页查询权限信息</p>
     *
     * @param authority the authority
     * @return list
     * @Author <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since 2018 /4/27 10:17
     */
    List<SysAuthority> queryListPage(SysAuthority authority);

    /**
     * <p>Title:      getAllAuthorityInfoList. </p>
     * <p>Description 查询权限树</p>
     *
     * @return List<AuthorityTreeVo>
     * @Author        <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since     2019/4/9 14:30
     */
    List<AuthorityTreeVo> getAllAuthorityInfoList();

    /**
     * <p>Title:      getBindPermissionByRoleIds. </p>
     * <p>Description 根据角色Id查询权限信息</p>
     *
     * @param        roleIds List<String>
     * @return      List<SysAuthority>
     * @Author        <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since     2019/4/25 19:20
     */
    List<SysAuthority> getBindPermissionByRoleIds(List<String> roleIds);

    /**
     * <p>Title:      getBindPermissionByRoleIds. </p>
     * <p>Description 根据角色Id查询权限信息</p>
     *
     * @param        roleIds List<String>
     * @return      List<SysAuthority>
     * @Author        <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since     2019/4/25 19:20
     */
    Collection<GrantedAuthority> loadUserAuthorities(List<String> roleIds);

    /**
     * <p>Title:     getAllResourceIdList . </p>
     * <p>Description 查询所有的资源id集合</p>
     *
     * @return       List<String>
     * @Author        <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since     2019/5/8 15:29
     */
    List<String> getAllResourceIdList();

    /**
     * <p>Title:      findAllPermission. </p>
     * <p>Description 查询所有权限</p>
     *
     * @return        List<PermissionDto>
     * @Author        <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since     2019/8/12 21:42
     */
    List<PermissionDto> findAllPermission();

    /**
     * <p>Title:      getBindRoleListByActionId. </p>
     * <p>Description 查詢当前权限字符串所绑定的角色信息</p>
     *
     * @param actionId String
     * @return Wrapper
     * @Author        <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since     2019/4/11 14:35
     */
    List<String> getBindRoleListByActionId(String actionId);

    /**
     * <p>Title:      bindRole. </p>
     * <p>Description 权限绑定角色</p>
     *
     * @param         actionBindRoleDto ActionBindRoleDto
     * @return        Wrapper
     * @Author        <a href="xinglinglove1029@163.com"/>杨文生</a>
     * @since     2019/4/11 17:23
     */
    void bindRole(ActionBindRoleDto actionBindRoleDto);

}